home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / apl / apltex_.com / APL2C_A.ASM < prev    next >
Encoding:
Assembly Source File  |  1990-02-04  |  2.5 KB  |  100 lines

  1. ; APL2C.ASM - APL to C Assembler functions ...
  2. ;    Support for APL2PC to C interface
  3. ;    ASM used to avoid use of C STDLIB fns..
  4.  
  5. ARG0           EQU     [bp + 4]    ;offset of first arg on stack
  6.  
  7. SVP            EQU     0B6H        ; Interrupt number for SVP.
  8. $GETM          EQU     4           ; Get storage from the Workspace.
  9. $RELM          EQU     5           ; Return storage to Workspace.
  10.  
  11.             DOSSEG                 ; std segment conventions
  12.            .MODEL    SMALL         ; Small memory model
  13.  
  14.  
  15.            .CODE                   ; code segment
  16.  
  17. ; APL_CS - return APL's code segment value
  18. ;          int apl_cs(void)
  19. PUBLIC     _apl_cs
  20. _apl_cs    PROC
  21.            push      bp
  22.            mov       bp,sp
  23.  
  24.            int 3                   ; provides breakpoint under CODEVIEW
  25.            push      ds
  26.            push      es
  27.            push      di
  28.            push      si
  29.  
  30.            mov       ax,cs                ; prepare to get var ptr
  31.            sub       ax,10h               ; adjust for offset
  32.                                           ; return to C
  33.            pop       si
  34.            pop       di
  35.            pop       es
  36.            pop       ds
  37.  
  38.            pop       bp
  39.  
  40.            ret
  41. _apl_cs    ENDP
  42.  
  43.  
  44.  
  45. ;SVP_GETM   uses SVP service to get block of (APL WS) memory
  46. ;           int svp_getm(int npars)
  47.  
  48. PUBLIC      _svp_getm
  49. _svp_getm   PROC
  50.             push    bp
  51.             mov     bp,sp
  52.  
  53.             push    si
  54.             push    di
  55.             push    ds
  56.             push    es
  57.             int 3
  58.             mov     dx,ARG0       ; #pars to DX
  59.             mov     ah,$GETM
  60.             int     SVP
  61.             mov     ax,ds         ; return DS
  62.  
  63.             pop     es
  64.             pop     ds
  65.             pop     di
  66.             pop     si
  67.             pop     bp
  68.             ret
  69.  
  70. _svp_getm   ENDP
  71.  
  72. ;SVP_RELM   uses SVP service to release block of (APL WS) memory
  73. ;           int svp_relm(int segmt)
  74.  
  75. PUBLIC      _svp_relm
  76. _svp_relm   PROC
  77.             push    bp
  78.             mov     bp,sp
  79.  
  80.             push    si
  81.             push    di
  82.             push    ds
  83.             push    es
  84.  
  85.             mov     ds,ARG0       ; segment to DS
  86.             mov     ah,$RELM
  87.             int     SVP
  88.             mov     ax,cx         ; return CX (error code,if any)
  89.  
  90.             pop     es
  91.             pop     ds
  92.             pop     di
  93.             pop     si
  94.             pop     bp
  95.             ret
  96.  
  97. _svp_relm   ENDP
  98.  
  99.             END
  100.